<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jquery-3.7.1.min.js"></script>
    <style>
        .box{
            width: 100px;
            height: 100px;
            background-color: red;
        }

        .box2{
             background-color: greenyellow;
        }
    </style>
</head>
<body>
    <div class="box1"></div>
    <div class="box2"></div>

    <script>
        //获取box1宽度和高度
        var width=$(".box1").width();
        var height=$(".box1").height();
        console.log(width,height);
        

        //设置box2的宽度和高度  链式调用
          $(".box2").width(200).height(200);
          
    </script>
</body>
</html>